package com.gljx.web.service.impl;

import com.gljx.web.Entity.SimulationQuarge;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.dao.SimulationQuargeMapper;
import com.gljx.web.service.SimulationQuargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class SimulationQuargeServiceImpl extends CommonDao implements SimulationQuargeService {
	
	@Autowired
	private SimulationQuargeMapper simulationQuargeMapper;
	
	@Override
	public SimulationQuarge selectSimulationQuargeByFid(String fid) {
		// TODO Auto-generated method stub
		return simulationQuargeMapper.selectSimulationQuargeByFid(fid);
	}

	@Override
	public String selectFnumber(String companyId) {
		// TODO Auto-generated method stub
		return simulationQuargeMapper.selectFnumber(companyId);
	}

	@Override
	public int addSimulationQuarge(SimulationQuarge simulationQuarge) {
		// TODO Auto-generated method stub
		return simulationQuargeMapper.insertSelective(simulationQuarge);
	}

	@Override
	public int deleteByPrimaryKey(String fid) {
		// TODO Auto-generated method stub
		return simulationQuargeMapper.deleteByPrimaryKey(fid);
	}

	@Override
	public SimulationQuarge selectByPrimaryKey(String fid) {
		// TODO Auto-generated method stub
		return simulationQuargeMapper.selectByPrimaryKey(fid);
	}

	@Override
	public Map<String, Object> selectPageCount(String psql) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Psql", psql);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        this.getSqlSession().select("com.gljx.web.dao.SimulationQuargeMapper.pagecount", paramMap, null);
        return paramMap;
	}

	@Override
	public Map<String, Object> selectPage(int pindex, String psql, int psize) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Pindex", pindex);
        paramMap.put("Psql", psql);
        paramMap.put("Psize", psize);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        paramMap.put("v_cur", oracle.jdbc.OracleTypes.CURSOR);
        this.getSqlSession().select("com.gljx.web.dao.SimulationQuargeMapper.pagemap", paramMap, null);
        return paramMap;
	}

	@Override
	public int updateSimulationQuarge(SimulationQuarge record) {
		// TODO Auto-generated method stub
		return simulationQuargeMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public List<SimulationQuarge> selectSimulationQuarge(String companyId, String fnumber, String fdescription, String beginTime, String endTime) {
		Map<String,String> map =new HashMap<String,String>();
		map.put("companyId",companyId);
		map.put("fnumber",fnumber);
		map.put("fdescription",fdescription);
		map.put("beginTime",beginTime);
		map.put("endTime",endTime);
		return simulationQuargeMapper.selectSimulationQuarge(map);
	}

}
